#!/bin/bash
# MQTT_BASE=/path/to/your/mosquitto/source

set -x

if [[ -z "${MOSQ_BASE}" ]]; then
    echo "Run MOSQ_BASE=/path/to/your/mosquitto ./b"
    exit 1
fi

if [[ ! -x configure ]]; then
    ./autogen.sh
fi

LIBDIR="${MOSQ_BASE}/build/lib/"
INCDIR="${MOSQ_BASE}/lib/"

mosquitto_CFLAGS=-I${INCDIR} mosquitto_LIBS=-L${LIBDIR} ./configure "${@}"
